package org.vidyakiran.app.server.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;
import org.vidyakiran.app.server.dao.SearchQueryDao;
import org.vidyakiran.app.server.dao.util.DatabaseUtils;
import org.vidyakiran.app.server.domain.entity.VolunteeringActivity;

@Repository
public class SearchQueryDaoJpaImpl implements SearchQueryDao{

	EntityManager em;
	
	@Override
	public List<Object> findOrganisationByLocation(String locationId) {
		em = DatabaseUtils.startTransaction(em);
		try {
			List<Object> result = (List<Object>)em.createQuery("from Organisation as O where O.locationTags.locationName=?1").setParameter(1,locationId ).getResultList();
			em.getTransaction().commit();
		} finally {
			DatabaseUtils.cleanupTransaction(em);
		}
		return null;
	}

}
